﻿@using Kevin.Shop.Business.Service.Entity.Helper
@section header
{
    <script type="text/javascript" src="~/Utility/swipe-1.0.js"></script>
}

<!-- BeginSlide -->
<div class="mt5" style="-webkit-transform:translate3d(0,0,0);">
    <div style="visibility: visible;" id="banner_box" class="box_swipe">
        <ul style="list-style: none outside none; width: 1280px; transition-duration: 500ms; transform: translate3d(0px, 0px, 0px);">
            @foreach(var item in Model.Banner.TopImages)
            {
                <li style="display: table-cell; vertical-align: top;">
                    <a  href="@item.NavigateUrl">
                        <img src="@item.ActualImageUrl" alt="22" style="width:100%;">
                    </a>
                </li>
            }
        </ul>
        <ol>
            <li class="on"></li>
            <li class=""></li>
        </ol>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        new Swipe(document.getElementById('banner_box'), {
            speed: 500,
            auto: 3000,
            callback: function () {
                var lis = $(this.element).next("ol").children();
                lis.removeClass("on").eq(this.index).addClass("on");
            }
        });
    });
</script>
<!-- End Slide -->
<!-- BeginPromoton -->
@foreach (var group in Model.Promotion.GroupList)
{
    <ul data-role="listview"  class="mb10" data-inset="true" >
        <!--今日特价-->
        <li data-role="list-divider"><h1 class="white">@group.CategoryName</h1></li>
        @foreach(var item in group.Products)
        {
            <li data-theme="none" data-icon="false">
                <a class="product-listlink" href="~/Product/ProductDetail?prd=@item.ProductId">
                    <div class="mb5">
                        <ul>
                            <li class="pList-item">
                                <div class="num_warp_list_top_white">
                                    <div class="num_warp_list_pic_mall ">
                                        <div class="iconPromB" data-theme="none">
                                            @if (!string.IsNullOrEmpty(@item.PromotionTypeStr))
                                            {
                                                <img src="@item.PromotionTypeIcon" alt="" />
                                            }                                            
                                        </div>
                                        <img alt="" class="prdImage"  src="@item.ActualImageUrl" />
                                    </div>
                                    <div class="num_warp_list_name_mall ">
                                        <h3 class="f14 normalwrap">@item.Title</h3>
                                        <div class="price mb10">￥@item.UnitPrice</div>
                                        <div class="koubei ml5">
                                            <span class="fl">已有(@item.ReviewCount)人评价</span>
                                            <span class="rating fl"><span style="width: @item.ReviewCount%" class="value"></span></span>
                                        </div>
                                    </div>
                                </div>
                            </li>
                            
                        </ul>
                    </div>
                </a>
            </li>
        }
    </ul>
} 
<!-- BeginPromoton -->
@{ Html.RenderAction("CategoryListPartialView", "Sort"); } 
<script language="javascript" type="text/javascript">
    // 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
    document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
        WeixinJSBridge.call('hideToolbar');
        // 发送给好友
        WeixinJSBridge.on('menu:share:appmessage', function (argv) {
            if (typeof (share_img) == "undefined") {
                win_open('alert', '此页面不允许转发');
            }
            else {
                shareFriend();
            }
        });
        // 分享到朋友圈
        WeixinJSBridge.on('menu:share:timeline', function (argv) {
            if (typeof (share_img) == "undefined") {
                win_open('alert', '此页面不允许转发');
            }
            else {
                shareTimeline();
            }
        });
    }, false);
    var appid = 'wxd6ba880532a24a07';
    var share_img = "http://www.3tcare.com/Themes/Default/img/logo.png";
    function shareTimeline() {
        var desc = $("#txtSitedesc").text();
        var title = $("title").html();
        WeixinJSBridge.invoke(
        'shareTimeline',
        {
            "appid": appid,
            "img_url": share_img,
            "img_width": "128",
            "img_height": "128",
            "link": window.location.href,
            "desc": desc,
            "title": desc
        },
        function (res) {
            //alert(res);
            /*intergral("timeline");*/
            //_report('timeline', res.err_msg);
        });
    }

    function shareFriend() {
        WeixinJSBridge.invoke(
            'sendAppMessage',
            {
                "appid": appid,
                "img_url": share_img,
                "img_width": "128",
                "img_height": "128",
                "link": window.location.href,
                "desc": $("#txtSitedesc").html(),
                "title": $("title").html()
            },
            function (res) {
                if (res.err_msg == "send_app_msg:confirm") {
                    intergral("friend");
                }

            });
    }
</script>